// 更改密码成功时显示的对话框

// 关闭VSCode非必要报错
// ignore_for_file: camel_case_types, sized_box_for_whitespace

import 'package:flutter/material.dart';
import 'package:project_award_statistics/pages/desktop_adwaita/login_page/login_page.dart';
import 'package:project_award_statistics/utils/my_yaru_buttons/my_yaru_button_confirmed.dart';
import 'package:yaru/yaru.dart';

class DialogChangePasswdSuccess_Desktop extends StatelessWidget {
  
  const DialogChangePasswdSuccess_Desktop({super.key});

  @override
  Widget build(BuildContext context) {
    return AlertDialog(
      backgroundColor: Theme.of(context).colorScheme.surface,
      // 设置对话框标题
      titlePadding: EdgeInsets.all(0),
      title: YaruDialogTitleBar(
        title: Text(
          "密码修改信息提示",
          style: TextStyle(
            fontSize: 18,
            fontWeight: FontWeight.bold,
          ),
        ),
        isClosable: false,   // 设置不可通过标题右上角关闭,只能通过按对话框进行关闭
      ),
      content: Container(
        height: 140,width: 400,   //设置对话框大小
        child: Column(     //设置行式布局
          children: [
            SizedBox(height: 15,),   //设置上下控件间间隔
            Center(
              child:
                Text(
                  "恭喜, 密码修改成功!",
                  style: TextStyle(
                    fontSize: 25,
                  ),
                ),
            ),
            SizedBox(height: 48,),
            Container(
              height:40,
              width:220,
              child:
                MyYaruButton_Confirmed(
                  text: "好的,现在回去登录", 
                  onPressed: (){     // 按下后跟随Navigator导航直接回到登录页面
                    Navigator.pushReplacement(
                      context, 
                      MaterialPageRoute(
                        builder: (context) => PopScope(
                          canPop: false,    // 设置页面不允许返回
                          child: LoginPage_Desktop(),
                        ),
                      ),
                    );   // 弹出对话框
                  },
                ),
            ),
          ],
        ),
      ),
    );
  }
}
